#ifndef IAPCLIENTADAPTER_H
#define IAPCLIENTADAPTER_H

#include <QObject>
#include <iapclient.h>

class MIAPClientAdapterObserver
{
public:
    virtual void Notify(int requestId, QString aMessage) = 0;
    virtual void ProductDataNotify(int requestId,
                                   QString productInformation,
                                   QString description,
                                   QString shortDescription,
                                   QString price) = 0;
};

class IAPClientAdapter : public QObject
{
    Q_OBJECT
public:
    explicit IAPClientAdapter(MIAPClientAdapterObserver& observer);

    TInt purchaseProduct(QString productId);
    TInt getProductData(QString productId);
    TInt getUserAndDeviceId();

signals:

private slots:
    void productDataReceived(int requestId, QString status,
                                    IAPClient::ProductDataHash productData);
    void userAndDeviceDataReceived(int requestId, QString status,
                                    IAPClient::UserAndDeviceDataHash userdata);

    void purchaseCompleted(int requestId, QString status, QString purchaseTicket);
    void purchaseFlowFinished(int requestId);

private:
    //data
    MIAPClientAdapterObserver   *iObserver;

    /*
     * In-Application Purchase API
     */
    IAPClient *iap_client;
    QString userAuth; // account digest
    QString iPurchaseDeferStat; // purchase deferred status
};

#endif // IAPCLIENTADAPTER_H
